#pragma once
#include <memory>
#include "Common.h"

class Primative
{
  friend class Scene;

  public:
    Primative() : 
      Reflection(0.0f), Diffuse(0.0f), Color(RGBColor()), IsLight(false) { }
    float Reflection;
    float Diffuse;
    RGBColor Color;
    bool IsLight;

    virtual float intersect(const Ray& ray, float& distance) = 0;
    virtual Float3 getCenter() = 0;
    virtual Float3 getNormal(const Float3& a) = 0;
};

class Sphere : public Primative
{
  public:
    Sphere(float radius, const Float3&& origin) :
      Radius(radius), Origin(origin) { }

    float Radius;
    Float3 Origin;

    virtual float intersect(const Ray& ray, float& distance);
    virtual Float3 getCenter() { return Origin; }
    virtual Float3 getNormal(const Float3& a) { return (a - Origin) * Radius; }
};

class Plane : public Primative
{
  public:
    Plane(const Float3& _p0, const Float3& p1, const Float3& p2);

    virtual float intersect(const Ray& ray, float& distance);
    virtual Float3 getCenter() { return Float3(0.0f, 0.0f, 0.0f); }
    virtual Float3 getNormal(const Float3& a) { return Normal; }

    Float3 p0;
    Float3 Normal;
};
